package com.joven.shelltest.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.joven.shelltest.entity.BankAccountModel;
import com.joven.shelltest.service.BankAccountService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: wzj
 * @Date: 2024/6/4 9:42
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/mpe")
public class MpEntityController {

    private final BankAccountService bankAccountService;

    @PostMapping("/testMp")
    public List<BankAccountModel> mpAcceptEntity(@RequestBody BankAccountModel bankAccountModel) {
        QueryWrapper<BankAccountModel> queryWrapper = new QueryWrapper<>(bankAccountModel);
        queryWrapper.last("limit 5").orderByDesc("create_time");
        return bankAccountService.list(queryWrapper);
    }

    @PostMapping("/testMpShow")
    public List<BankAccountModel> resultShow(@RequestBody BankAccountModel bankAccountModel) {
        QueryWrapper<BankAccountModel> queryWrapper = new QueryWrapper<>(bankAccountModel, "account", "name", "mobile");
        return bankAccountService.list(queryWrapper);
    }

}
